<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>报表模板管理</title>
<jsp:include page="../../../common/head.jsp">
	<jsp:param name="_spPage" value="true"/>
</jsp:include>
		<script language="javaScript">	
	// 添加报表模板
	function ins_report_engine()
	{
		window.location.href="insReportEngine.do";
	}
	// 查看报表模板
	function show_report_engine(idValue)
	{
		window.location.href="updateReportEngine.do?edit=false&reportId="+idValue;
	}
	// 修改报表模板
	function upd_report_engine(idValue)
	{
		window.location.href="updateOwnReportEngine.do?reportId="+idValue;
	}
	// 复制报表模板
	function copy_report_engine(str)
	{
		var a = ModalWindow("jump.do?path=saveCopyOwnReportEngine.do&reportId="+str,640,480);
		if(a=="ok")
		{
			window.location.reload();
		}
	}

	function showReportDetail(reportId){
		var path1="listDetailReportEngine.do?edit=false&reportId="+reportId;
		var path2="${ctx}/blank_common.jsp?title=报表项目管理";
		var url = conversionUrl(path1,path2,350);
		window.location.href="jump!GoIndexUrl.do?a=b"+url;
	}
	// 删除报表项目
	function del_report_engine(idValue)
	{
		if(confirm("确认删除？"))
		{
			var a = ModalWindow("jump.do?path=delReportEngine.do&reportId="+idValue,640,480);
			if(a=="ok")
			{
				xjSpPage.spPageSubmit();
			}
		}
	}
</script>
	</head>
	<body>
	<form name="form1" action="listOwnerReportEngine.do" method="post">
	<div id="body_div">
	<w:ShowTitle name="报表模板管理">
	<w:TitleButton funcName="查询" onClickFunction="_queryDivBg(this)" urlImg="${ctx}/images/main/query.png"/>
	<w:TitleButton funcName="添加" onClickFunction="ins_report_engine()" urlImg="${ctx}/images/main/add.png"/>
	</w:ShowTitle>
	<div id="body_content">
			<div id="queryDiv">
				<table width="100%">
					<tr>
						<td colspan="4" class="td_title">
							报表模板查询
						</td>
					</tr>
					<tr>
						<td width="110">
							模板编码
						</td>
						<td width="120" class="left_align">
							<input name="reportEngine.reportId" type="text" value="${reportEngine.reportId}"/>
						</td>
						<td width="110">
							模板名称
						</td>
						<td class="left_align">
							<input name="reportEngine.reportName" type="text" value="${reportEngine.reportName}"/>
						</td>
					</tr>
					<tr>
						<td width="110">
							所属模块
						</td>
						<td width="120" class="left_align">
							<input name="reportEngine.belongTable" type="text" value="${reportEngine.belongTable}"/>
						</td>
						<td width="110">
						</td>
						<td class="left_align">
						</td>
					</tr>
					
					<tr>
						<td colspan="4">
							<input name="button" type="submit" class="btn_standard" value="　查 询" />
							<input name="button" type="button" class="btn_standard" onclick="_cancelQuery()" value="取消" />
						</td>
					</tr>
				</table>
			</div>	
				<table width="100%">
					<tr>
						<td class="td_title" width="120">
							模板编号
						</td>
						<td class="td_title" width="180">
							模板名称
						</td>
						<td class="td_title" width="120">
							所属模块
						</td>
						<td class="td_title" width="120">
							模板类型
						</td>
						<td class="td_title" width="120">
							报表级别
						</td>
						<td class="td_title">
							描述
						</td>
						<td class="td_title" width="140">
							操作
						</td>
					</tr>
					<c:forEach items="${datalist}" var="obj">
						<tr>
							<td>
								${obj.reportId}
							</td>
							<td>
								${obj.reportName}
							</td>
							<td>
								${obj.belongTable}
							</td>
							<td>
								<c:choose>
									<c:when test="${obj.reportType eq 'jxl'}">excel报表</c:when>
						   			<c:when test="${obj.reportType eq 'jxls'}">excel模板型报表</c:when>
						   			<c:when test="${obj.reportType eq 'jasperReport'}">jasperReport报表</c:when>
								</c:choose>
							</td>
							<td>
								${obj.shareType}
							</td>
							<td>
								${obj.reportNote}
							</td>
							<td class="left_align">
								<a href="#" onclick="show_report_engine('${obj.reportId}')">查看</a>
								<a href="#" onclick="copy_report_engine('${obj.reportId}')">复制</a>
								<c:choose>
								<c:when test="${obj.shareType eq '系统'}">
									<c:if test="${obj.reportType eq 'jxl'}">
										<a href="#" onclick="showReportDetail('${obj.reportId}')">详细</a>
									</c:if>
								</c:when>
								<c:otherwise>
									<a href="#" onclick="upd_report_engine('${obj.reportId}')">修改</a>
								</c:otherwise>
								</c:choose>
								<c:if test="${obj.reportType eq 'jxls' or obj.reportType eq 'jasperReport'}">
									<c:if test="${obj.reportPath ne null and obj.reportPath ne ''}">
										<c:if test="${obj.reportType eq 'jxls'}">
								        	<a href="download.do?filename=${obj.reportName}.xls&inputPath=${obj.reportPath}" target="_blank">下载</a>
						        		</c:if>
						        		<c:if test="${obj.reportType eq 'jasperReport'}">
								        	<a href="download.do?filename=${obj.reportName}.jasper&inputPath=${obj.reportPath}" target="_blank">下载</a>
						        		</c:if>
									</c:if>
								</c:if>
							</td>
						</tr>
					</c:forEach>
				</table>
				<w:spPage />
			</div>
	</div>
	</form>
	</body>
</html>




